package com.inspur_video.inspur_video.dao;

import com.inspur_video.inspur_video.bean.video.Video;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.data.jpa.repository.JpaRepository;
import org.springframework.data.jpa.repository.Modifying;

import java.util.List;

/**
 * Created with IntelliJ IDEA.
 *
 * @author 小浩
 * @date 2018-07-30 11:23
 * @package com.inspur_video.inspur_video.dao
 * @description
 */

public interface VideoDao extends JpaRepository<Video, Integer> {
    //根据数据库主键查询
    Video findVideoByVId(int id);

    //根据阿里云主键查询视频信息（单个）
    Video findVideosByAIdEquals(String aId);

    //根据阿里云主键查询视频信息（批量）
    Page<Video> findVideosByAIdIn(List<String> aIds, Pageable pageable);

    //根据阿里云主键删除视频
    @Modifying
    int deleteVideoByAIdIn(List<String> ids);

    List<Video> findByVTitleLikeOrVDescribeLikeOrVTagLike(String title, String describe, String tags);

    Page<Video> findByVTitleLikeOrVDescribeLikeOrVTagLike(String title, String describe, String tags, Pageable pageable);


    //找出带有分类的(视频或者电视剧)
    List<Video> findByVCategory(int category);

    List<Video> findByVTitleLike(String title);

    //查询待分类的视频
    List<Video> findByVTitleLikeAndVCategory(String title,int category);


    //根据标题和输入集数查询
    List<Video> findByVTitleLikeAndVNumber(String title,int number);
}
